import Vue from "vue";
import VueRouter from "vue-router";
import HmArticle from "../views/HmArticle.vue";
import HmCollect from "../views/HmCollect.vue";
import HmLike from "../views/HmLike.vue";
import HmUser from "../views/HmUser.vue";
import HmLayout from "../views/Layout.vue";
import HmDetail from "@/views/HmDetail.vue";
import HmLogin from "@/views/HmLogin.vue";
import HmRecommend from "@/views/HmRecommend.vue";
import HmNew from "@/views/HmNew.vue";
import HmItem from "@/views/HmItem.vue";
Vue.use(VueRouter);

const router = new VueRouter({
  routes: [
    { path: "/", redirect: "/login" },
    { path: "/detail", component: HmDetail },
    { path: "/login", component: HmLogin },
    {
      path: "/layout",
      component: HmLayout,
      name: "MyLayout",
      //   配置二级路径
      children: [
        {
          path: "/layout/article",
          component: HmArticle,
          children: [
            { path: "/layout/article/item", component: HmItem },
            { path: "/layout/article/recommend", component: HmRecommend },
            { path: "/layout/article/new", component: HmNew },
          ],
        },
        { path: "/layout/collect", component: HmCollect },
        { path: "/layout/like", component: HmLike },
        { path: "/layout/user", component: HmUser },
      ],
    },
  ],
});

export default router;
